Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(i18n): fix and update CLDR to v30.0.1 #15997

Closed
wants to merge 5 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented May 19, 2017

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Fix, i18n update.

What is the current behavior? (You can also link to an open issue here)
Locale files based on CLDR 29 and broken i18n/ scripts.

What is the new behavior (if this is a feature change)?
Locale files based on CLDR 30.0.1 and working i18n/ scripts.

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

Other information:
Fixes #15976.

gkalpak added 4 commits May 19, 2017 20:36
Previously, it was assumed that all currency pattern would have fraction digits.
However, in [closure-library@b9155d5][1] the `agq_CM` locale was modified to
have such a pattern (namely `#,##0\u00A4`).
This commit modifies the parser implementation to account for pattern without a
decimal point (and thus no fraction digits).

[1]: google/closure-library@b9155d5#diff-02793124214ad0470ccea6f86b90d786R711
@Narretz
Copy link
Contributor

Narretz commented May 19, 2017

Do you know why the scripts broke? Because they must have worked before.
Could you also add the instructions for updating the CLDR files to the contributing.md?

@gkalpak
Copy link
Member Author

gkalpak commented May 20, 2017

I don't know why or when the scripts/tests broke. It is possible that someone run the node scripts directly from inside the i18n/ directory, instead of running the i18n/generate.sh script (which runs the tests and the node scripts).

There is a README.md inside i18n/ that explains what each script and directory is for.

@@ -75,7 +75,6 @@ describe('findLocaleId', function() {
it('should not find localeId if data is missing', function() {
expect(findLocaleId('', 'num')).toBeUndefined();
expect(findLocaleId('aa', 'datetime')).toBeUndefined();
expect(findLocaleId('aa', 'randomType')).toBeUndefined();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this assertion bad? Or, what caused it to be bad?

Copy link
Member Author

@gkalpak gkalpak May 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws an "unknown type in findLocaleId: randomType" error. This is what the next test verifies.
I assume that at some point someone decided to change the implementation, so that unknown types cause an error (vs returning undefined), but didn't update this test.

Maybe we should run these tests on CI.

@@ -33,7 +46,12 @@ function parsePattern(pattern) {
positive = patternParts[0],
negative = patternParts[1];

var positiveParts = positive.split(DECIMAL_SEP),
// The parsing logic below assumes that there will always be a DECIMAL_SEP in the pattern.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused by this. Does it mean if a locale doesn't have a DECIMAL_SEP, we add it after the last ZERO, which means it will be discarded later (because nothing comes after it)? So we only add it for the sake of parsing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much. We add it for the sake of parsing, because what comes after the DECIMAL_SEP determines the min/max fraction size (depending on the number of ZERO and DIGIT occurrences) and also the posSuf. For example, if we have #,##0$, we convert it to #,##0.$, which (when parsed) results in minFrac: 0, maxFrac: 0, posSuf: $ - i.e. have 0 fraction digits and tput $ after the number (posSuf).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. Can you please a short summary of this to the comment? I think this will be helpful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody reads comments. When you want to understand the code, you look at the tests 😛
(I'll update the comment.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@gkalpak gkalpak closed this in e5c5b4a Jun 6, 2017
gkalpak added a commit that referenced this pull request Jun 6, 2017
@gkalpak gkalpak deleted the chore-i18n-fix-and-update branch June 6, 2017 10:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update locales from closure-library
3 participants